package com.jwater.core.manager.master.event;

import com.jwater.core.serialize.SerializeUtils;

/**
 * @description:工作进程退出时间
 * @author: jnner
 * @createDate: 2021/2/5
 * @version: 1.0
 */
public class OfflineEvent extends GroupEvent {
    private String regionName;
    private String deployName;
    private String groupName;
    private String workerName;
    private int index;

    @Override
    public String getType() {
        return GroupEvent.TYPE_OFFLINE;
    }

    @Override
    public byte[] serialize() {
        return SerializeUtils.serializeArray(regionName, deployName, groupName, workerName, index);
    }

    @Override
    public OfflineEvent deserialize(byte[] data) {
        Object[] objs = SerializeUtils.deserializeArray(data);
        this.regionName = (String) objs[0];
        this.deployName = (String) objs[1];
        this.groupName = (String) objs[2];
        this.workerName = (String) objs[3];
        this.index = (int) objs[4];
        return this;
    }

    public String getRegionName() {
        return regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getWorkerName() {
        return workerName;
    }

    public void setWorkerName(String workerName) {
        this.workerName = workerName;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public String getDeployName() {
        return deployName;
    }

    public void setDeployName(String deployName) {
        this.deployName = deployName;
    }
}
